<?php

use App\Http\Controllers\Web\Payment\NotifyController;
use App\Http\Controllers\Web\OauthController;
use App\Http\Controllers\IndexController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', [IndexController::class,'index']);
Route::get('/orderCallback',[IndexController::class,'orderCallback']);//创建订单回调任务【测试】

// 支付模块
Route::prefix('payment')->group(function () {
    // /payment/notify/wechat/1000
    Route::post('/notify/wechat/{appid}', [NotifyController::class,'wechat'])->where(['appid'=>'^\w{4,10}$']);//微信支付回调
    Route::post('/notify/alipay/{appid}', [NotifyController::class,'aliPay'])->where(['appid'=>'^\w{4,10}$']);//支付宝异步回调
    Route::get('/return/alipay/{appid}', [NotifyController::class,'alipayReturn'])->where(['appid'=>'^\w{4,10}$']);//支付宝同步回调
});

// Oauth登录模块
Route::prefix('oauth')->group(function () {
    // /oauth/wechat/mobile/1000
    Route::any('/wechat/pushEvent/{type?}', [OauthController::class,'pushEvent'])->where(['type'=>'\w+']);//微信事件回调
    Route::any('/{name}/{type}/{appid}', [OauthController::class,'index']);//第三方登录
//    Route::any('/wechat/pushEvent/{type?}', 'NotifyController@pushEvent')->where(['type'=>'\w+']);//微信事件回调
//    Route::any('/{name}/{type?}', 'OauthController@index');//第三方登录
});
